package com.smartwebx.ha.biz.rainwater.real.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smartwebx.ha.biz.rainwater.real.GrwManager;
import com.smartwebx.ha.dal.assign.bean.HaArea;
import com.smartwebx.ha.dal.realtime.dao.GrwMapper;
import com.smartwebx.ha.dal.usebean.DateValue;
import com.smartwebx.ha.dal.usebean.GisWater;
import com.smartwebx.ha.dal.util.core.WaterProcessDatasAnalysis;
import com.smartwebx.ha.util.GisStationInProvOrInCity;

@Service
public class GrwManagerImpl implements GrwManager {
	@Autowired
	private GrwMapper grwDao;

	@Override
	public List<GisWater> getAllStatGroundWater(Date datePoint,HaArea area) {
		List<GisWater> gisWaters=grwDao.getAllStatGroundWaterStcdFilter(datePoint);
		GisStationInProvOrInCity gisStationInProvOrInCity= new GisStationInProvOrInCity();
		for(GisWater gisWater:gisWaters){
			gisWater.setInProvOrInCity(gisStationInProvOrInCity.inProvOrInCity(gisWater,area));
		}
		return gisWaters;
	}

	@Override
	public List<DateValue> getSingleStatWaterDayProcess(String stcd,
			Date startDate, Date endDate) {
		return WaterProcessDatasAnalysis.getSingleStatDayProcess(grwDao, stcd,
				startDate, endDate, "water");
	}

	@Override
	public List<DateValue> getPurenessWaterProcesss(String stcd,
			Date startDate, Date endDate) {
		return WaterProcessDatasAnalysis.getPurenessProcesss(grwDao, stcd,
				startDate, endDate, "water");
	}

}